package ds;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.HashSet;

public class WordSet {
	private HashSet<String> dictionary;
	
	public WordSet(){
		dictionary = new HashSet<String>();
	}
	
	public WordSet(String keywordFile) {
		dictionary = new HashSet<String>();
		try {
			BufferedReader reader = new BufferedReader(new FileReader(keywordFile));
			String word = "";
			while((word = reader.readLine()) != null){
				if(!dictionary.contains(word))
					dictionary.add(word);			
			}	
			reader.close();
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	public boolean isKeyword(String word) {
		return dictionary.contains(word);
	}
}
